< previous page page_297 next page >

Page 297
Knowing the Models
A large part of creating a quality ActiveX control lies in the detailsthat is, verifying the design and runtime settings of every property, method, event, and user input. Defining these ahead of time will go a long way toward helping you succeed. Before creating the control, you should know that you can follow three different models:
8694cbadb9b1ef7075903f6f95fc1db2.gif
Enhancing existing controls
8694cbadb9b1ef7075903f6f95fc1db2.gif
Building complex controls from existing controls
8694cbadb9b1ef7075903f6f95fc1db2.gif
Creating user-drawn controls
Each model addresses a specific area of the design concept.
Enhancing Existing Controls
In this model, your control contains a single existing control. Most of the properties, methods, and events of the control are mapped to public properties, methods, and events of your control. Your control can add new properties or events, or otherwise modify the behavior of the standard control. For example, you could implement a text box that will convert all the text entered to uppercase characters.
The biggest advantage of enhancing an existing control is that it's extremely easy to do. The ActiveX control interface wizard can do much of the work of mapping public properties, methods, and events. Although this is the easiest method, you might want to use another approach for the following reasons:
8694cbadb9b1ef7075903f6f95fc1db2.gif
Each existing control defines its own behavior and drawing characteristics. There are limits to what you can do to modify the control.
8694cbadb9b1ef7075903f6f95fc1db2.gif
Existing controls are always in run mode when your control is active, making it impossible to set the control's design-time properties even though the new control is in design mode. For example, if you want to create an enhanced list box that supported single and multiple selection modes, you would need to place two separate list box controls into your control: one for single selection and one for multiple selection.
8694cbadb9b1ef7075903f6f95fc1db2.gif
As soon as you go beyond the built-in controls or redistributable controls provided by Microsoft, you run into licensing issues. For your control to work in the design environment, each existing control must be properly licensed.
Building Complex Controls from Existing Controls
This model is really a superset of the preceding model, except that rather than map your public properties and events to a single control, you map them to any or all of the existing controls in the new control. It's also possible to map the same property to more than one control.

 
< previous page page_297 next page >

If you like this book, buy it!